//
//  CYBaseViewController.m
//  CreditAddressBook
//
//  Created by Lee on 15/7/8.
//  Copyright (c) 2015年 Lee. All rights reserved.
//

#import "CYBaseViewController.h"
#import "MobClick.h"
#import "CYJumpsTool.h"
#import "CYBackBarButtonItem.h"

@interface CYBaseViewController ()

@property (nonatomic, strong) NSString *className;

@end

@implementation CYBaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
//    [self setupBackBarButton];
   
    self.className = [[NSStringFromClass([self class]) componentsSeparatedByString:@"."] firstObject];
//    CYLog(@"页面名称：%@", [CYJumpsTool interfaceNameWithClassName:self.className]);
}

- (void)setupNavigationView {
    UIView *naviView = [[UIView alloc] init];
    naviView.backgroundColor = CYNaviThemeColor;
    naviView.frame = CGRectMake(0, 0, self.view.width, 64);
    [self.view addSubview:naviView];
}

- (void)setupBackBarButton {
    self.navigationItem.leftBarButtonItem = [[CYBackBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"black-50"] style:UIBarButtonItemStylePlain target:self action:@selector(backClick:)];
}

- (void)backClick:(CYBackBarButtonItem *)btn {
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    //页面的统计
    [MobClick beginLogPageView:[CYJumpsTool interfaceNameWithClassName:self.className]];
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    //页面的统计
    [MobClick endLogPageView:[CYJumpsTool interfaceNameWithClassName:self.className]];
}

@end
